<template>
	<div class="index-box" v-loading="loading">
    <div class="backBox">
        <span class="back" @click="back"><i class="el-icon-back"></i>返回</span>
    </div>
    <el-tabs type="border-card" v-model="tabsActiveName" class="tabsBox">
    	<el-tab-pane label="门店信息" name="store">
          <el-form label-width="200px" :model="storeMsgForm" ref="storeMsgForm" label-position="top" :rules="storeMsgFormRules"
          	class="formBlock">
          	<el-card class="margin-top cardBox" header="店铺基本信息">
          		<div class="left">
          			<el-form-item label="店铺名称" prop="storeName" label-width="165px">
                  <span slot="label">
                    店铺名称 <span class="miniTips">（店铺名一经填写，不允许修改，且作为店铺唯一标识，为更方便让用户查找到您的店铺，请认证填写。）</span>
                  </span>
          				<el-input type="text" v-model="storeMsgForm.storeName" placeholder="请输入店铺名称" clearable
          					class="textInput"></el-input>
          			</el-form-item>
          			<el-form-item label="主营类目" prop="categoryId" label-width="165px">
                  <span slot="label">
                    主营类目 <span class="miniTips">（标题不规范会引起商品下架，影响您的正常销售，请认真填写。）</span>
                  </span>
          				<treeselect v-model="storeMsgForm.categoryId" :flat="true"
          					@select="treeselectSelect" :options="storeTypeList" :normalizer="normalizer"
          					placeholder="请选择主营类目" clearable class="textInput" />
          			</el-form-item>
                <div class="d-flex">
                  <el-form-item label="营业时间" prop="businessTimeType" label-width="165px" style="width:50%">
                    <span slot="label">
                      营业时间 <span class="miniTips">（您店铺的正常营业时间。）</span>
                    </span>
                  	<el-radio-group v-model="storeMsgForm.businessTimeType">
                  		<el-radio label="1">24小时</el-radio>
                  		<el-radio label="2">自定义</el-radio>
                  	</el-radio-group>
                  </el-form-item>
                  <el-form-item label="自定义营业时间" label-width="165px" v-if="storeMsgForm.businessTimeType=='2'" style="width:50%">
                  	<el-time-select placeholder="起始时间" v-model="startTime" :picker-options="{
                          start: '00:00',
                          step: '00:01',
                          end: '23:59'
                          }" style="margin-right: 10px;width: 140px;">
                  	</el-time-select>
                  	至
                  	<el-time-select placeholder="结束时间" v-model="endTime" :picker-options="{
                          start: '00:00',
                          step: '00:01',
                          end: '23:59',
                          }" style="margin-left: 10px;width: 140px;">
                  	</el-time-select>
                  </el-form-item>
                </div>
               <!-- <el-form-item label="店铺类型" prop="businessTimeType" label-width="165px">
                  <span slot="label">
                    店铺类型 <span class="miniTips">（请按照您的入驻申请选择，将用来区分店铺佣金比例及为您自动配置发货模式，有助于您后续对店商品及佣金进行管理。）</span>
                  </span>
                	<el-radio-group v-model="storeMsgForm.storeType">
                		<el-radio :label="2">线上电商</el-radio>
                		<el-radio :label="1">线下门店</el-radio>
                	</el-radio-group>
                </el-form-item> -->

                <div><!--线下门店-->
                  <el-form-item label="门店所在区域" prop="storeAreaCode" label-width="165px" v-if="!loading">
                  	<!-- <el-cascader v-model="storeMsgForm.storeAreaCode" :props="areaProps"
                  		@change="areaChange" show-all-levels placeholder="请选择门店所在区域" clearable
                  		class="textInput" ref="cascaderAddr" style="width:100%"></el-cascader> -->
                      <el-cascader
                         ref="cascaderAddr"
                          v-model="storeMsgForm.storeAreaCode"
                          :options="bankAreaList"
                           :props="codeProps"
                           show-all-levels
                          @change="addressChange($event,'storeAreaCode')"></el-cascader>
                  </el-form-item>
                  <el-form-item label="门店详情地址" prop="mapName" label-width="165px" class="storeAddressDetail">
                  	<el-input type="text" v-model="storeMsgForm.mapName" placeholder="请输入门店详情地址" clearable
                  		class="textInput" @change="changeStoreAddr"><template slot="append"><span
                  				@click="mapVisible = true" style="cursor: pointer;">从地图中选点</span></template>
                  	</el-input>
                  </el-form-item>
                  <el-form-item label="客服电话" prop="storeName" label-width="165px">
                    <span slot="label">
                      客服电话
                    </span>
                  	<el-input type="text" v-model="storeMsgForm.telephone" placeholder="请输入客服电话" clearable
                  		class="textInput"></el-input>
                  </el-form-item>
                 <!-- <el-form-item label="线下门店服务费" prop="offlineServiceFee" label-width="165px" v-if="invitationCodeTipsShow">
                      <el-radio-group v-model="storeMsgForm.offlineServiceFee" :disabled="type!='add'">
                         <el-radio label="5">5%</el-radio>
                         <el-radio label="10">10%</el-radio>
                         <el-radio label="20">20%</el-radio>
                      </el-radio-group>
                  </el-form-item> -->
                  <div class="d-flex">
                    <el-form-item label="门店门面图:" prop="storeCoverImg" label-width="165px">
                       	<MyUpMoreImg :imagePreview='storeCoverImg'   imageSize="chang" imageLimit="3" @change="imageMultiChange1($event)" ></MyUpMoreImg>
                       </el-form-item>
                   <!-- <el-form-item label="门店门面图:" prop="storeHeadPic" label-width="165px">
                      	<MyUpImg :imagePreview='storeMsgForm.storeHeadPic' imageSize="chang"
                      		@change="imageChange($event, 'storeHeadPic')"></MyUpImg>
                      </el-form-item>
                      <el-form-item label="店内照片图1:" prop="storeInnerPic1" label-width="165px" style="margin:0 25px">
                      	<MyUpImg :imagePreview='storeMsgForm.storeInnerPic1' imageSize="chang"
                      		@change="imageChange($event, 'storeInnerPic1')"></MyUpImg>
                      </el-form-item>
                      <el-form-item label="店内照片图2:" prop="storeInnerPic2" label-width="165px">
                      	<MyUpImg :imagePreview='storeMsgForm.storeInnerPic2' imageSize="chang"
                      		@change="imageChange($event, 'storeInnerPic2')"></MyUpImg>
                      </el-form-item> -->
                    </div>
                </div>
               <!-- <div v-else-if="storeMsgForm.storeType==2">
                  <el-form-item label="商品加价比例" prop="markupRate" label-width="165px" v-if="storeId">
                  	<el-input v-model="storeMsgForm.markupRate" placeholder="请输入商品加价比例" clearable
                  		class="textInput" style="width:210px" type="number">
                  		<template slot="append">%</template>
                  	</el-input>
                  </el-form-item>
                </div> -->
                <el-form-item label="入驻合同:" label-width="165px">
                  <a :href="shortUrl" target="_blank" v-if="shortUrl" style="color:#61997A">点击去查看电子合同</a>
                  <div v-else-if="contractPic">
                  	<MyUpMoreImg  :imagePreview='contractPic' imageSize="chang" imageLimit="10" @change="imageChange($event,'contractPic')"></MyUpMoreImg>
                  </div>
                </el-form-item>
          		</div>
          		<div class="right">
          			<el-form-item label="门店LOGO:" prop="storeLogo" label-width="165px">
          				<MyUpImg :imagePreview='storeMsgForm.storeLogo'
          					@change="imageChange($event, 'storeLogo')"></MyUpImg>
          			</el-form-item>
          		</div>
          	</el-card>
         <!-- 	<el-card class="margin-top cardBox promoter" header="推广者信息" v-if="type=='add' || (type=='edit' && storeMsgForm.invitationCode) || (type=='detail' && storeMsgForm.invitationCode)">
              <el-form-item label="推广人姓名"  label-width="165px" v-if="spreaderMsg.recommendName">
                 <el-input type="text" v-model="spreaderMsg.recommendName" placeholder="" disabled></el-input>
              </el-form-item>
              <el-form-item label="推荐码" prop="invitationCode" label-width="165px">
              	<el-input type="text" v-model="storeMsgForm.invitationCode" placeholder="推荐码" clearable class="textInput" :disabled="invitationCodeDisabled || type!='add'" @change="changeInvitationCode" maxlength="6"></el-input>
              </el-form-item>
              <el-form-item label="推广人手机号"  label-width="165px" v-if="spreaderMsg.recommendTelephone">
                 <el-input type="text" v-model="spreaderMsg.recommendTelephone" placeholder="" disabled></el-input>
              </el-form-item>
              <el-form-item label="线上电商服务费"  label-width="165px" v-if="invitationCodeTipsShow" >
                  <el-radio-group v-model="topServiceFee" :disabled="type!='add'">
                     <el-radio label="1">20%</el-radio>
                  </el-radio-group>
              </el-form-item>
          	</el-card> -->
          	<div class="active d-flex justify-center" v-if="type=='edit'">
          		<el-button type="primary" @click="handleStoreSubmit('storeMsgForm')" :loading="btnLoading">修改提交审核</el-button>
          	</div>
            <div class="active d-flex justify-center" v-if="type=='add'">
            	<el-button type="primary" @click="handleNext" :loading="btnLoading">下一步</el-button>
            </div>
          </el-form>
      </el-tab-pane>
      <el-tab-pane label="资质信息" name="certification" >
        <el-form label-width="165px" :model="aptitudeMsgForm" ref="aptitudeMsgForm"
        	:rules="aptitudeMsgFormRules" class="formBlock certificationForm" label-position="top">
        	<el-card class="margin-top cardBox" header="资质信息">
        		<div class="left">
        			<el-form-item label="账号类型" prop="accountType">
                <span slot="label">
                  账号类型 <span class="miniTips">（账号类型决定企业类别与结算类型，为保障您能够正常结算，请认真填写。）</span>
                </span>
        				<el-radio-group v-model="aptitudeMsgForm.accountType">
        					<el-radio :label="1">对私账号</el-radio>
        					<el-radio :label="2">对公账号</el-radio>
        				</el-radio-group>
        			</el-form-item>

        			<el-form-item label="公司名称" prop="signName" label-width="165px">
                <span slot="label">
                  公司名称 <span class="miniTips">（请填写与工商营业执照一致的主体名称，为不影响您的审核进度，请认真填写。）</span>
                </span>
        				<el-input type="text" v-model="aptitudeMsgForm.signName" placeholder="请输入公司名称" clearable
        					class="textInput"></el-input>
        			</el-form-item>

        			<el-form-item label="执照所在区域名称" prop="blRegionCode">
              <el-cascader
                  v-model="aptitudeMsgForm.blRegionCode"
                  :options="bankAreaList"
                   :props="codeProps"
                   show-all-levels
                  @change="addressChange($event)"></el-cascader>

        			</el-form-item>
        			<el-form-item label="执照所在区域详细地址" prop="address" label-width="165px">
        				<el-input type="text" v-model="aptitudeMsgForm.address" placeholder="请输入执照所在区域详细地址"
        					clearable class="textInput"></el-input>
        			</el-form-item>
              <el-form-item label="统一社会信用代码" prop="licenceNo" label-width="165px"
              	v-if="aptitudeMsgForm.accountType=='2'">
              	<el-input type="text" v-model="aptitudeMsgForm.licenceNo" placeholder="请输入统一社会信用代码"
              		clearable class="textInput"></el-input>
              </el-form-item>
        			<!-- <el-form-item label="开户许可证编号" prop="openAccountLicenceNo" label-width="165px"
        				v-if="aptitudeMsgForm.accountType=='2'">
        				<el-input type="text" v-model="aptitudeMsgForm.openAccountLicenceNo"
        					placeholder="请输入开户许可证编号" clearable class="textInput"></el-input>
        			</el-form-item>

        			 -->

        		</div>
        		<div class="right">
        			<el-form-item label="营业执照图: " prop="licenceUrl" label-width="165px">
                <span slot="label">
                  营业执照图 <span class="miniTips">（营业执照是您执业资格的表现，也是您店铺正常营业的保障，请如实上传。）</span>
                </span>
        				<MyUpImg :imagePreview='aptitudeMsgForm.licenceUrl' imageSize="chang"
        					@change="imageChange($event,'licenceUrl','aptitudeMsgForm')"></MyUpImg>
        			</el-form-item>
              <el-form-item label="企业类型" prop="signType" v-if="aptitudeMsgForm.accountType=='2'">
                <span slot="label">
                  企业类型 <span class="miniTips">（请选择与工商营业执照一致的类型，为不影响您的审核进度，请认真填写。）</span>
                </span>
               	<el-radio-group v-model="aptitudeMsgForm.signType">
               		<el-radio label="ENTERPRISE">企业</el-radio>
                  <el-radio label="INDIVIDUAL">个体工商户</el-radio>
               	</el-radio-group>
               </el-form-item>
               <el-form-item label="公司简称" prop="shortName" label-width="165px" v-if="aptitudeMsgForm.accountType=='2'">
                 <span slot="label">
                   公司简称 <span class="miniTips">（公司简称为您企业内部或对外简便称呼，如阿里巴巴，简称阿里。）</span>
                 </span>
               	<el-input type="text" v-model="aptitudeMsgForm.shortName" placeholder="请输入公司简称"
               		clearable class="textInput"></el-input>
               </el-form-item>

             <!--


        			<el-form-item label="银行卡正面: " prop="bankFrontPic" label-width="165px"
        				v-if="aptitudeMsgForm.accountType=='1'">
        				<MyUpImg :imagePreview='aptitudeMsgForm.bankFrontPic' imageSize="chang"
        					@change="imageChange($event,'bankFrontPic','aptitudeMsgForm')"></MyUpImg>
        			</el-form-item> -->
        		</div>
            <div style="width:100%;padding:0 20px">
              <el-form-item label="商品资质:" prop="attachmentIds" label-width="165px">
                  <MyUpMoreImg :imagePreview='productQualification'  imageLimit="3" returnType="obj" imageSize="chang" @change="imageMultiChange($event)" ></MyUpMoreImg>
               </el-form-item>
            </div>

        	</el-card>
          <el-card class="margin-top cardBox" header="银行卡信息">
          	<div class="left">
          		<el-form-item label="开户行名称" prop="bankCode">
          			<el-select v-model="aptitudeMsgForm.bankCode" filterable placeholder="请选择开户行名称"
          				style="width: 100%;" @change="bankCodeChange">
          				<el-option v-for="item in bankList" :key="item.bankCode" :label="item.bankName"
          					:value="item.bankCode">
          				</el-option>
          			</el-select>
          		</el-form-item>
          		<el-form-item label="银行账号" prop="bankCardNo">
          			<el-input type="text" v-model="aptitudeMsgForm.bankCardNo" placeholder="银行账号" clearable
          				class="textInput"></el-input>
          		</el-form-item>
              <el-form-item label="银行账户类型" prop="bankAccountType" v-if="aptitudeMsgForm.accountType=='1'">
              	<el-radio-group v-model="aptitudeMsgForm.bankAccountType">
              		<el-radio label="DEBIT_CARD">借记卡</el-radio>
              		<el-radio label="PASSBOOK">存折</el-radio>
              	</el-radio-group>
              </el-form-item>
              <el-form-item label="银行账户类型" prop="bankAccountType" v-if="aptitudeMsgForm.accountType=='2'">
              	<el-radio-group v-model="aptitudeMsgForm.bankAccountType">
              		<el-radio label="UNIT_SETTLEMENT_CARD">单位结算卡</el-radio>
              		<el-radio label="ENTERPRISE_ACCOUNT">对公账户</el-radio>
              	</el-radio-group>
              </el-form-item>

          	</div>
          	<div class="right">
              <el-form-item label="开户许可证:" prop="openAccountLicenceUrl" label-width="165px"
              	v-if="aptitudeMsgForm.accountType=='2'">
              	<MyUpImg :imagePreview='aptitudeMsgForm.openAccountLicenceUrl' imageSize="chang"
              		@change="imageChange($event,'openAccountLicenceUrl','aptitudeMsgForm')"></MyUpImg>
              </el-form-item>
          	</div>
          </el-card>

        	<el-card class="margin-top cardBox" header="法人信息">
        		<div class="left">
        			<el-form-item label="法人姓名:" prop="legalName">
        				<el-input type="text" v-model="aptitudeMsgForm.legalName" placeholder="请输入法人姓名"
        					clearable class="textInput" :disabled="isRealName"></el-input>
        			</el-form-item>
        			<el-form-item label="法人身份证号" prop="legalLicenceNo">
        				<el-input type="text" v-model="aptitudeMsgForm.legalLicenceNo" placeholder="请输入法人身份证号"
        					clearable class="textInput" :disabled="isRealName"></el-input>
        			</el-form-item>
              <p>法人身份证图片</p>
              <div class="d-flex">
                <el-form-item label="身份证正面图:" prop="legalLicenceFrontUrl" label-width="165px">
                	<MyUpImg :imagePreview='aptitudeMsgForm.legalLicenceFrontUrl' imageSize="chang"
                		@change="imageChange($event,'legalLicenceFrontUrl','aptitudeMsgForm')"
                		:disabled="isRealName"></MyUpImg>
                </el-form-item>
                <el-form-item label="身份证反面图:" prop="legalLicenceBackUrl" label-width="165px" style="margin-left:20px">
                	<MyUpImg :imagePreview='aptitudeMsgForm.legalLicenceBackUrl' imageSize="chang"
                		@change="imageChange($event,'legalLicenceBackUrl','aptitudeMsgForm')"
                		:disabled="isRealName"></MyUpImg>
                </el-form-item>
              </div>


        		</div>
        		<div class="right">
              <el-form-item label="法人手机号:" prop="legalMobile" v-if="aptitudeMsgForm.accountType=='1'">
              	<el-input type="text" v-model="aptitudeMsgForm.legalMobile" placeholder="请输入法人手机号"
              		clearable class="textInput" :disabled="isRealName"></el-input>
              </el-form-item>
              <el-form-item label="联系人姓名:" prop="contactName" v-if="aptitudeMsgForm.accountType=='2'">
              	<el-input type="text" v-model="aptitudeMsgForm.contactName" placeholder="请输入联系人姓名"
              		clearable class="textInput" ></el-input>
              </el-form-item>
              <el-form-item label="联系人身份证号:" prop="contactLicenceNo"
              	v-if="aptitudeMsgForm.accountType=='2'">
              	<el-input type="text" v-model="aptitudeMsgForm.contactLicenceNo"
              		placeholder="请输入联系人身份证号" clearable class="textInput" >
              	</el-input>
              </el-form-item>
              <el-form-item label="联系人手机号:" prop="contactMobile" v-if="aptitudeMsgForm.accountType=='2'">
              	<el-input type="text" v-model="aptitudeMsgForm.contactMobile" placeholder="请输入联系人手机号"
              		clearable class="textInput" ></el-input>
              </el-form-item>
              <el-form-item label="邮箱账号:" prop="contactEmail" v-if="aptitudeMsgForm.accountType=='2'">
              	<el-input type="text" v-model="aptitudeMsgForm.contactEmail" placeholder="请输入邮箱账号"
              		clearable class="textInput" ></el-input>
              </el-form-item>
        		</div>
        	</el-card>
        	<div class="active d-flex justify-center"  ><!-- v-if="type=='add'"   :loading="btnLoading"-->
        		<el-button type="primary" :loading="btnLoading" @click="handleAddSubmit('aptitudeMsgForm','storeMsgForm')"
        			>新增提交审核</el-button>
        	</div>
        	<div class="active d-flex justify-center" v-if="type=='edit' && mchtStatus=='3'">
        		<el-button type="primary" @click="handleAptitudeSubmit('aptitudeMsgForm')"
        			:loading="btnLoading">修改提交审核</el-button>
        	</div>
        </el-form>
      </el-tab-pane>
    </el-tabs>
   <!-- <div class="d-flex align-center justify-center" style="margin-top:20px" v-if="storeStatus=='1' && type!='detail'">
      <el-button type="primary" disabled>信息审核中...</el-button>
    </div> -->

    <el-dialog title="选择定位" width="1200px" v-dialogDrag :close-on-click-modal="false" :visible.sync="mapVisible"
    	@close="mapVisible = false" class="mapBox">
    	<qq-map map-key="T23BZ-PHZHD-LMY4N-PIPBF-R636H-S2F4K" key-name="qdStoreAdmin" @callback="callback"
    		@hideMap="showMap = false"></qq-map>
    	<div slot="footer" class="dialog-footer">
    		<el-button @click="mapVisible = false" size="small">取 消</el-button>
    		<el-button type="primary" @click="selectMapLocation" size="small" :loading="btnLoading">确 定</el-button>
    	</div>
    </el-dialog>
	</div>
</template>

<script>
  let vm;
	import {
		regionData,
		CodeToText
	} from 'element-china-area-data';
	import {
		getStoreInfo,
		saveCustomerStore,
		selOneCustomer,
		updateCustomerStore,
		selReturnedValue,
		BgetBankInfo,
    updateStoreApplyBaseInfo,
    BgetBankAreaList,
    updateStoreOtherInfo,
    BgetStoreApplyDetails,
    storeApply,
    getInvitationCode,
    getUserType,
    editStore,
    BstoreApply,
    getStoreDetails
	} from '@/api/getData'
	import {
		isCard,
		isPhone,
		isEmail,
		isBankNumber
	} from '../../common/validate.js';
	import common from "@/api/api";
	import option from '../../common/option.js';
	import Treeselect from "@riophae/vue-treeselect";
	import "@riophae/vue-treeselect/dist/vue-treeselect.css";
	import qs from 'qs';
	import {
		jsonp
	} from 'vue-jsonp';
	import QqMap from '@/components/Qqmap/qqmap'
	export default {
		name: 'customer_store_insert',
		data() {
			let that = this
			return {
				img: require('@/assets/icon_address.png'),
        tabsActiveName:'store',//tab 选中栏
        storeStatus:'',//1待审核 2已通过  3驳回
				mapVisible: false,
				mapData: {},
				btnLoading: false,
				loading: false,
				cascaderOptions: regionData,
				/*省市区插件数据*/
				storeTypeList: [], //门店类型
        bankAreaList:[],//执照所在区域
				storeId: "",
				type: "",
				customerId: '',
				entrance: '', //查询详情入口  user  audit 请求不同接口
        mchtStatus:'1',//商户审核状态：1待审核2审核通过3审核失败
        shortUrl: '', //合同链接
        contractPic: [],//合同图片老数据用到
        storeCoverImg:[],
				/* 门店信息	*/
				storeMsgForm: {
					storeName: "",
					categoryId: undefined,
					storeCategoryName: '',
					storeAreaCode: [],
					storeAreaName: '',
          storeType:1,

					storeAddress: '',
					longitude: "",
					latitude: '',
					mapName: '', //地图上选的点
					markupRate: '',
          telephone:'',

					businessTimeType: '1',
					businessTime: '',

					storeLogo: '',
					storeCoverImg:[],//门店装修图多张图拼接

          invitationCode:'',
          offlineServiceFee:'5',

          storeSettledType:1,//店铺类型 1线上  2线下
				},
				storeMsgFormRules: {
					storeName: [{
						required: true,
						message: '请输入店铺名称',
						trigger: 'blur'
					}],
					categoryId: [{
						required: true,
						message: '请选择主营类目',
						trigger: 'blur'
					}],
					storeAreaCode: [{
						required: true,
						message: '请选择店铺地址所属辖区',
						trigger: 'blur'
					}],
					mapName: [{
						required: true,
						message: '请输入店铺详情地址',
						trigger: 'blur'
					}],
					businessTimeType: [{
						required: true,
						message: '请选择营业时间',
						trigger: 'blur'
					}],
					businessTime: [{
						required: true,
						message: '请输入自定义营业时间',
						trigger: 'blur'
					}],
					markupRate: [{
						required: true,
						message: '请输入商品加价比例',
						trigger: 'blur'
					}],
					storeLogo: [{
						required: true,
						message: '请上传门店LOGO',
						trigger: 'blur'
					}],
					storeCoverImg: [{
						required: true,
						message: '请上传门店门面图',
						trigger: 'blur'
					}],
          storeSettledType: [{
						required: true,
						message: '请选择店铺类型',
						trigger: 'blur'
					}],
				},
				/* 资质信息	*/
				aptitudeMsgForm: {
					accountType: 1,
          signType:'INDIVIDUAL',
					signName: '',
					shortName: '',
					licenceNo: '',
					blRegionCode: [],
          blRegionName:[],
					address: '',
					openAccountLicenceNo: '',
          bankAccountType:'ENTERPRISE_ACCOUNT',
					bankCode: '',
					bankName: '',
					bankCardNo: '',
					licenceUrl: '',
					openAccountLicenceUrl: '',
					bankFrontPic: '',
					legalName: '',
					legalLicenceNo: '',
          contactName:'',
          contactLicenceNo:'',

					contactMobile: '',
					contactEmail: '',
					legalLicenceFrontUrl: '',
					legalLicenceBackUrl: '',
          legalMobile:'',

          attachmentIds:[],

				},
        productQualification:[],
				aptitudeMsgFormRules: {
     //      attachmentIds:[{
					// 	required: true,
					// 	message: '请上传商品资质',
					// 	trigger: 'blur'
					// }],
					accountType: [{
						required: true,
						message: '请选择账号类型',
						trigger: 'blur'
					}],
					signName: [{
						required: true,
						message: '请输入公司名称',
						trigger: 'blur'
					}],
          signType: [{
						required: true,
						message: '请选择公司类型',
						trigger: 'blur'
					}],
					shortName: [{
						required: true,
						message: '请输入公司简称',
						trigger: 'blur'
					}],
					licenceNo: [{
						required: true,
						message: '请输入统一社会信用代码',
						trigger: 'blur'
					}],
					blRegionCode: [{
						required: true,
						message: '请选择执照所在区域',
						trigger: 'blur'
					}],
					address: [{
						required: true,
						message: '请输入执照详细地址',
						trigger: 'blur'
					}],
					openAccountLicenceNo: [{
						required: true,
						message: '请输入开户许可证编号',
						trigger: 'blur'
					}],
					address: [{
						required: true,
						message: '请输入执照详细地址',
						trigger: 'blur'
					}],
          bankAccountType: [{
						required: true,
						message: '请选中银行账户类型',
						trigger: 'blur'
					}],
					bankCode: [{
						required: true,
						message: '请输入开户行',
						trigger: 'blur'
					}],
					bankCardNo: [{
						required: true,
						message: '请输入银行账号',
						trigger: 'blur'
					}],
					licenceUrl: [{
						required: true,
						message: '请上传营业执照图',
						trigger: 'blur'
					}],
					openAccountLicenceUrl: [{
						required: true,
						message: '请上传开户许可证',
						trigger: 'blur'
					}],
					bankFrontPic: [{
						required: true,
						message: '请上传银行卡正面',
						trigger: 'blur'
					}],

					legalName: [{
						required: true,
						message: '请输入法人姓名',
						trigger: 'blur'
					}],
					legalLicenceNo: [{
						required: true,
						validator: isCard,
						trigger: 'blur'
					}],
					contactMobile: [{
						required: true,
						validator: isPhone,
						trigger: 'blur'
					}],
					contactEmail: [{
						required: true,
						validator: isEmail,
						trigger: 'blur'
					}],
					legalLicenceFrontUrl: [{
						required: true,
						message: '请上传身份证正面图',
						trigger: 'blur'
					}],
					legalLicenceBackUrl: [{
						required: true,
						message: '请上传身份证反面图',
						trigger: 'blur'
					}],
          contactName: [{
          	required: true,
          	message: '请输入邮箱联系人姓名',
          	trigger: 'blur'
          }],
          contactLicenceNo: [{
          	required: true,
          	message: '请输入联系人身份证号',
          	trigger: 'blur'
          }],
          legalMobile: [{
						required: true,
						validator: isPhone,
						trigger: 'blur'
					}]
				},
				bankList: [], //开户行列表
				startTime: '00:00',
				endTime: '23:59',
				isRealName: false, //1已实名
				/*		验证规则		*/
				categories: [],
				areas: [],
				levels: [],

				areaProps: {
					/*地址加载*/
					lazy: true,
					lazyLoad(node, resolve) {
						that.$axios({
							method: 'get',
							url: common.apihost + '/system/area/getList?pcode=' + (node.value ? node.value : '0'),
						}).then((res) => {
							if (res.data.code == 200) {
								const nodes = res.data.data;
								nodes.forEach(item => {
									item.value = item.code,
										item.label = item.name,
										item.leaf = item.level >= 5
								})
								resolve(nodes);
							} else {
								this.$message.error(res.msg)
							}
						})
					}
				},
        codeProps:{
          value:'areaCode',
          label:'areaName',
          leaf:'children',
        },
        topServiceFee:'1',
        invitationCodeDisabled:false,
        invitationCodeTipsShow:false,
        spreaderMsg:{},//推广人信息集合
			}
		},
		activated() {
			//	如果第二次进入修改的数据不同，则重新获取数据
			if (this.$route.query.customerId != this.formItem.customerId) {
				this.formItem.customerId = this.$route.query.customerId
				//this.loadData()
			}
		},
		computed: {
			pickerOptions: () => {
				return option.pickerOptions;
			}
		},
		mounted() {
      vm = this;
			this.storeId = this.$route.query.storeId;
			this.type = this.$route.query.type;
			this.customerId = this.$route.query.customerId;
			this.entrance = this.$route.query.entrance;
			if (this.$route.query.type == 'edit') {
				/*修改  type=='edit'修改  type=='add' 新增   type='detail'详情 */
				this.dataInfo();
			} else if (this.$route.query.type == 'add') {
        this.getUserReferralCodeFn();//获取是否有上级 用户推荐码
				/*新增*/
			} else if (this.$route.query.type == 'detail') {
				/*详情*/
				this.dataInfo();
			}
			this.getSelect();
		},
		components: {
			Treeselect,
			QqMap
		},
		methods: {
      imageMultiChange1(path, name) {
        console.log(path, name)
        let img = [];
        for(let i=0;i<path.length;i++){
         img.push(path[i]);
        }
        this.storeCoverImg = img;
        this.storeMsgForm.storeCoverImg = img;
      },
      getUserReferralCodeFn(){/*获取是否有上级 用户推荐码*/
        getInvitationCode({customerId:this.customerId}).then(res => {
          if (res.code == 200) {
            if(res.data.invitationCode){
              this.storeMsgForm.invitationCode = res.data.invitationCode;
              this.invitationCodeDisabled = true;
            }else{
              this.storeMsgForm.invitationCode = '';
              this.invitationCodeDisabled = false;
            }
          }else{
            this.$message.error(res.msg)
          }
        })
      },
      changeInvitationCode(){
        console.log(this.storeMsgForm.invitationCode.length)
        if(this.storeMsgForm.invitationCode.length=='6'){
          getUserType({invitationCode:this.storeMsgForm.invitationCode}).then(res => {
            if (res.code == 200) {
               if(res.data.userType=='1'){// 0正常用户 1推广者用户 2已注册商家用户
                 this.invitationCodeTipsShow = true;
               }else{
                 this.invitationCodeTipsShow = false;
               }
            }else{
              this.$message.error(res.msg)
            }
          })
        }
      },
      imageMultiChange(path, name){
         let productQualification = [];
         let attachmentIds = [];
         for(let i=0;i<path.length;i++){
          productQualification.push(path[i].fullFilename);
          attachmentIds.push(path[i].attachmentId)
         }
         this.productQualification = productQualification;
         this.aptitudeMsgForm.attachmentIds = attachmentIds;
      },
      handleNext(){
        this.tabsActiveName = 'certification'
      },
      /* 资质信息提交审核 */
      handleAptitudeSubmit(formName) {
      	this.$refs[formName].validate((valid) => {
      		if (valid) {
            let data1 = JSON.parse(JSON.stringify(this.aptitudeMsgForm));
            console.log(this.aptitudeMsgForm.blRegionCode)
            let data2 = {
              customerStoreId: this.customerId,
              storeApplyId:this.storeId,
              provinceCode: this.aptitudeMsgForm.blRegionCode[0],
              provinceName: this.aptitudeMsgForm.blRegionName[0],
              cityCode: this.aptitudeMsgForm.blRegionCode[1],
              cityName: this.aptitudeMsgForm.blRegionName[1],
              districtCode: this.aptitudeMsgForm.blRegionCode[2],
              districtName: this.aptitudeMsgForm.blRegionName[2],
            }
            this.btnLoading = true;
            editStore({...data1,...data2}).then(res => {
              if (res.code == 200) {
                  this.$message.success(res.msg);
                  this.btnLoading = false;
                  setTimeout(()=>{
                    this.$router.go(-1);
                  },2000)
              }else{
                this.btnLoading = false;
                this.$message.error(res.msg)
              }
            })
      		}
      	})
      },
			/* 编辑回填数据 */
			async dataInfo() {
				try {
					this.loading = true;
          let result;
          if(this.$route.query.storeApplyId){
            result = await BgetStoreApplyDetails({storeApplyId: this.$route.query.storeApplyId});
          }else if(this.$route.query.storeId){
            result = await getStoreDetails({storeId: this.$route.query.storeId});
          }

					if (result.code == 200) {
             console.log(this.aptitudeMsgForm,'88')
						let customerStore = result.data.storeApply || result.data.storeInfo;
						let storeFinanceInfo = result.data.storeFinanceInfo;
						let storeLegalInfo = result.data.storeLegalInfo;
						let storeRegisterApply = result.data.storeRegisterApply;
            this.storeStatus = customerStore.status?customerStore.status:'';

            let productQualification = [];
            let attachmentIds = [];
            // for(let i=0;i<storeLegalInfo.attachmentInfoList.length;i++){
            //  productQualification.push(storeLegalInfo.attachmentInfoList[i].fullFilename);
            //  attachmentIds.push(storeLegalInfo.attachmentInfoList[i].attachmentId)
            // }
            this.aptitudeMsgForm.attachmentIds = attachmentIds;
            this.productQualification = productQualification;

            this.storeMsgForm.telephone = customerStore.telephone ||  customerStore.telephone;
						this.storeMsgForm.storeName = customerStore.storeName ||  customerStore.name ;
						this.storeMsgForm.categoryId = customerStore.categoryId+'' || customerStore.categoryId+'';
						this.storeMsgForm.categoryName = customerStore.categoryName || customerStore.categoryName;
						this.storeMsgForm.storeAreaCode = (customerStore.storeAreaCode && customerStore.storeAreaCode.split(',')) || (customerStore.areaCode?customerStore.areaCode.split(','):'');
            this.storeMsgForm.storeType = customerStore.storeSettledType;

						this.storeMsgForm.storeAreaName = customerStore.areaName.split(',');
						this.storeMsgForm.storeAddress = customerStore.storeAddress || customerStore.address;
						this.storeMsgForm.longitude = customerStore.longitude;
						this.storeMsgForm.latitude = customerStore.latitude;
						this.storeMsgForm.mapName = customerStore.mapName;
						this.storeMsgForm.businessTimeType = customerStore.businessTimeType + '';
						this.storeMsgForm.businessTime = customerStore.businessTime || customerStore.businessTime;
            if(this.storeMsgForm.businessTimeType=='2'){
              let str = (customerStore.businessTime && customerStore.businessTime.split('~')) || (customerStore.businessTime.split('~'));
              this.startTime = str[0];
              this.endTime = str[1];
            }
						this.storeMsgForm.storeLogo = customerStore.storeLogo || customerStore.logo;
            if(customerStore.storeCoverImg){
              this.storeMsgForm.storeCoverImg = customerStore.storeCoverImg.split(',');
              this.storeCoverImg = customerStore.storeCoverImg.split(',');
            }
            console.log(this.storeMsgForm.storeAreaName,'99')

						this.storeMsgForm.markupRate = customerStore.markupRate;
            this.storeMsgForm.storeSettledType = customerStore.storeSettledType;
            console.log(this.storeMsgForm)

						this.aptitudeMsgForm.accountType = customerStore.accountType;
            this.aptitudeMsgForm.signType = storeLegalInfo.signType;
						this.aptitudeMsgForm.signName = storeLegalInfo.signName;
						this.aptitudeMsgForm.shortName = storeLegalInfo.shortName;
						this.aptitudeMsgForm.licenceNo = storeLegalInfo.licenceNo;
						this.aptitudeMsgForm.blRegionCode = [storeLegalInfo.provinceCode,storeLegalInfo.cityCode,storeLegalInfo.districtCode],
            this.aptitudeMsgForm.blRegionName = [storeLegalInfo.provinceName,storeLegalInfo.cityName,storeLegalInfo.districtName],
						this.aptitudeMsgForm.address = storeLegalInfo.address;
            this.aptitudeMsgForm.legalMobile = storeLegalInfo.legalMobile;
						this.aptitudeMsgForm.openAccountLicenceNo = storeLegalInfo.openAccountLicenceNo;
            this.aptitudeMsgForm.bankAccountType = storeFinanceInfo.bankAccountType;
						this.aptitudeMsgForm.bankCode = storeFinanceInfo.bankCode;
						this.aptitudeMsgForm.bankName = storeFinanceInfo.bankName;
						this.aptitudeMsgForm.bankCardNo = storeFinanceInfo.bankCardNo;
						this.aptitudeMsgForm.licenceUrl = storeLegalInfo.licenceUrl;
						this.aptitudeMsgForm.openAccountLicenceUrl = storeLegalInfo.openAccountLicenceUrl;
						this.aptitudeMsgForm.bankFrontPic = storeFinanceInfo.bankFrontPic;
						this.aptitudeMsgForm.legalName = storeLegalInfo.legalName;
						this.aptitudeMsgForm.legalLicenceNo = storeLegalInfo.legalLicenceNo;
						this.aptitudeMsgForm.contactMobile = storeLegalInfo.contactMobile;
            this.aptitudeMsgForm.contactLicenceNo = storeLegalInfo.contactLicenceNo;
            this.aptitudeMsgForm.contactName = storeLegalInfo.contactName;
						this.aptitudeMsgForm.contactEmail = storeLegalInfo.contactEmail;
						this.aptitudeMsgForm.legalLicenceFrontUrl = storeLegalInfo.legalLicenceFrontUrl;
						this.aptitudeMsgForm.legalLicenceBackUrl = storeLegalInfo.legalLicenceBackUrl;

            this.mchtStatus = customerStore.mchtStatus;
            this.shortUrl = result.data.shortUrl || '';
            this.contractPic = customerStore.contractPic?customerStore.contractPic.split(','):[];

            if(customerStore.mapList.recommendInvitationCode){
              this.storeMsgForm.invitationCode = customerStore.mapList.recommendInvitationCode;
              this.storeMsgForm.offlineServiceFee = customerStore.mapList.offlineServiceFee+'';
              this.invitationCodeTipsShow = (customerStore.mapList.userType == '1');
              this.spreaderMsg = customerStore.mapList;
            }

            console.log(this.storeMsgForm.storeAreaName,'4444')
					} else {
						this.$message.error(result.msg);
					}
          this.loading = false;
					//更新右上角未读消息个数
					this.$EventBus.$emit('getNoticeCountBus')
				} catch (err) {
					this.loading = false;
				}
			},

      treeselectSelect(node, instanceId) {
        console.log(node, instanceId);
        this.storeMsgForm.categoryName = node.dictLabel;
        // let name = '';
        // for(let i=0;i<this.storeTypeList.length;i++){
        //   if(this.storeTypeList[i].dictValue == node.name){
        //     name = this.storeTypeList[i].name;
        //     console.log(name)
        //     this.storeMsgForm.categoryName = name;
        //     return;
        //   }
          // if(this.storeTypeList[i].children){
          //   for(let a=0;a<this.storeTypeList[i].children.length;a++){
          //     if(this.storeTypeList[i].children[a].name == node.name){
          //       name = this.storeTypeList[i].children[a].name;
          //        console.log(name)
          //       this.storeMsgForm.categoryName = name;
          //       return;
          //     }

          //   }
          // }
        //}
      },
      /* 根据具体位置请求经纬度 */
      getLocation(){
        return new Promise((resolve, reject)=> {
            let addressMap = this.$refs['cascaderAddr'].getCheckedNodes()[0].pathLabels;
            let address = addressMap[0] + addressMap[1] + addressMap[2] + this.storeMsgForm.mapName;
            jsonp('https://apis.map.qq.com/ws/geocoder/v1/', {
            	output: 'jsonp',
            	key: 'T23BZ-PHZHD-LMY4N-PIPBF-R636H-S2F4K',
            	address: address
            }).then((res) => {
            	if (res.status == '0') {
            		const location = res.result ? res.result.location : '';
            		if (location) {
            			if (location.lng == '' || location.lat == '') {
            				this.$message.error('门店地址有误，请确认');
            				this.btnLoading = false;
                    reject('门店地址有误，请确认');
            			} else {
            				this.storeMsgForm.longitude = location.lng
            				this.storeMsgForm.latitude = location.lat
            				resolve();
            			}
            		}
            	} else {
                this.$message.error('门店地址有误，请确认');
            		reject('门店地址有误，请确认');
            		this.btnLoading = false;
            	}
            })
        });

      },
			/* 门店信息提交审核 */
			handleStoreSubmit(formName) {
				this.$refs[formName].validate((valid) => {
					if (valid) {
            this.btnLoading = true;
            if(!this.storeMsgForm.longitude){/* 手动输入地址需要请求经纬度 */
                this.getLocation().then(()=>{
                  this.handleStoreSubmitFn();
                })
            }else{/* 从地址中选点直接有经纬度直接提交后台 */
              this.handleStoreSubmitFn();
            }
					}
				})
			},
      /*** 提交门店信息审核 */
      handleStoreSubmitFn(){
        let data = {
        	customerStoreId: this.customerId,
          //customerStoreId:"6",
          storeId:this.storeId,
        	storeName: this.storeMsgForm.storeName,
        	categoryId: this.storeMsgForm.categoryId,
        	storeCategoryName: this.storeMsgForm.storeCategoryName,
        	storeAreaCode: this.storeMsgForm.storeAreaCode.join(','),
        	storeAreaName: this.storeMsgForm.storeAreaName.join(','),
        	storeAddress: this.storeMsgForm.storeAddress,
          storeSettledType: this.storeMsgForm.storeType,
        	mapName: this.storeMsgForm.mapName,
        	longitude: this.storeMsgForm.longitude,
        	latitude: this.storeMsgForm.latitude,
        	businessTimeType: this.storeMsgForm.businessTimeType,
        	businessTime: this.storeMsgForm.businessTimeType=='2'?(this.startTime+'~'+this.endTime):'00:00~23:59',
        	storeLogo: this.storeMsgForm.storeLogo,
          telephone:this.storeMsgForm.telephone,
        	// storeHeadPic: this.storeMsgForm.storeHeadPic,
        	// storeInnerPic1: this.storeMsgForm.storeInnerPic1,
        	// storeInnerPic2: this.storeMsgForm.storeInnerPic2,
          storeCoverImg:this.storeMsgForm.storeCoverImg.join(','),
          markupRate: this.storeMsgForm.markupRate,

          invitationCode: this.storeMsgForm.invitationCode,
          offlineServiceFee: this.storeMsgForm.offlineServiceFee,
        }
        updateStoreApplyBaseInfo(data).then(res => {
        	if (res.code == '200') {
        		this.$message.success(res.msg);
            setTimeout(()=>{
              this.$router.go(-1);
            },2000)
        	} else {
        		this.$message.error(res.msg)
        	}
          this.btnLoading = false;
        })
      },
			/** 手动输入门店地址 **/
			changeStoreAddr() {
				this.storeMsgForm.longitude = '';
				this.storeMsgForm.latitude = '';
				this.storeMsgForm.storeAddress = this.storeMsgForm.mapName;
			},
			/** 地图选择回调 **/
			callback(mapData) {
				this.showMap = false;
				this.mapData = mapData;
			},
			/** 选择地图中的点 **/
			selectMapLocation() {
				this.mapVisible = false;
				this.storeMsgForm.mapName = this.mapData.poiname;
				this.storeMsgForm.longitude = this.mapData.latlng.lng;
				this.storeMsgForm.latitude = this.mapData.latlng.lat;
				this.storeMsgForm.storeAddress = this.mapData.poiaddress;
			},
			/** 开户行修改 **/
			bankCodeChange() {
        console.log(this.aptitudeMsgForm.bankCode)
				for (let i = 0;this.bankList.length;i++) {
					if (this.bankList[i].bankCode == this.aptitudeMsgForm.bankCode) {
						this.aptitudeMsgForm.bankName = this.bankList[i].bankName;
            console.log(this.bankList[i].bankName);
            break;
					}
				}
			},
			/* 商家入驻新增 */
			handleAddSubmit(formName1, formName2) {
				this.$refs[formName1].validate((valid1) => {
					if (valid1) {
						this.$refs[formName2].validate((valid2) => {
							if (valid2) {
                this.btnLoading = true;
                if(!this.storeMsgForm.longitude){/* 手动输入地址需要请求经纬度 */
                    this.getLocation().then(()=>{
                      this.handleAddSubmitFn();
                    })
                }else{/* 从地址中选点直接有经纬度直接提交后台 */
                  this.handleAddSubmitFn();
                }
							}else{
                this.$message.error('门店信息未填写完整！');
              }
						})
					}
				})
			},
      /* 商家入驻新增方法 */
      async handleAddSubmitFn(){
        try {
                let data = {
                  customerId:this.customerId,
                  storeName:this.storeMsgForm.storeName,
                  categoryId:this.storeMsgForm.categoryId,
                  categoryName:this.storeMsgForm.categoryName,
                  areaCode:this.storeMsgForm.storeAreaCode.join(','),
                  areaName:this.storeMsgForm.storeAreaName.join(','),
                  address:this.storeMsgForm.storeAddress,
                  mapName:this.storeMsgForm.mapName,
                  latitude:this.storeMsgForm.latitude,
                  longitude:this.storeMsgForm.longitude,
                  storeLogo:this.storeMsgForm.storeLogo,
                  telephone:this.storeMsgForm.telephone,
                  storeCoverImg:this.storeMsgForm.storeCoverImg.join(','),
                  // headPic:this.storeMsgForm.storeHeadPic,
                  // headPic1:this.storeMsgForm.storeInnerPic1,
                  // headPic2:this.storeMsgForm.storeInnerPic2,
                  businessTimeType: this.storeMsgForm.businessTimeType,
                  businessTime: this.storeMsgForm.businessTimeType=='2'?(this.startTime+'~'+this.endTime):'00:00~23:59',

                  storeSettledType:this.storeMsgForm.storeType,
                  accountType:this.aptitudeMsgForm.accountType,
                }
                if(this.aptitudeMsgForm.accountType=='1'){/*对私账号 */
                  data.microMerchantsRegisterVo = {
                      licenceUrl: this.aptitudeMsgForm.licenceUrl,
                      signName: this.aptitudeMsgForm.signName,

                      legalName: this.aptitudeMsgForm.legalName,
                      legalMobile: this.aptitudeMsgForm.legalMobile,
                      legalLicenceNo: this.aptitudeMsgForm.legalLicenceNo,
                      legalLicenceFrontUrl: this.aptitudeMsgForm.legalLicenceFrontUrl,
                      legalLicenceBackUrl: this.aptitudeMsgForm.legalLicenceBackUrl,
                       provinceCode: this.aptitudeMsgForm.blRegionCode[0],
                       provinceName: this.aptitudeMsgForm.blRegionName[0],
                       cityCode: this.aptitudeMsgForm.blRegionCode[1],
                       cityName: this.aptitudeMsgForm.blRegionName[1],
                       districtCode: this.aptitudeMsgForm.blRegionCode[2],
                       districtName: this.aptitudeMsgForm.blRegionName[2],
                      bankCardNo: this.aptitudeMsgForm.bankCardNo,

                      address: this.aptitudeMsgForm.address,
                      bankName: this.aptitudeMsgForm.bankName,
                      bankAccountType: this.aptitudeMsgForm.bankAccountType,
                      bankCode: this.aptitudeMsgForm.bankCode,
                      bankFrontPic: this.aptitudeMsgForm.bankFrontPic,

                      attachmentIds:this.aptitudeMsgForm.attachmentIds.join(',')
                    }
                }else{/*对公账号 */
                 data.enterpriseMerchantsRegisterVo = {
                   licenceUrl: this.aptitudeMsgForm.licenceUrl,
                   signType:this.aptitudeMsgForm.signType,
                   legalName: this.aptitudeMsgForm.legalName,
                   legalMobile: this.aptitudeMsgForm.legalMobile,
                   legalLicenceNo: this.aptitudeMsgForm.legalLicenceNo,
                   legalLicenceFrontUrl: this.aptitudeMsgForm.legalLicenceFrontUrl,
                   legalLicenceBackUrl: this.aptitudeMsgForm.legalLicenceBackUrl,
                   provinceCode: this.aptitudeMsgForm.blRegionCode[0],
                   provinceName: this.aptitudeMsgForm.blRegionName[0],
                   cityCode: this.aptitudeMsgForm.blRegionCode[1],
                   cityName: this.aptitudeMsgForm.blRegionName[1],
                   districtCode: this.aptitudeMsgForm.blRegionCode[2],
                   districtName: this.aptitudeMsgForm.blRegionName[2],
                   address: this.aptitudeMsgForm.address,
                   bankName: this.aptitudeMsgForm.bankName,
                   bankAccountType: this.aptitudeMsgForm.bankAccountType,
                   bankCode: this.aptitudeMsgForm.bankCode,

                   bankCardNo: this.aptitudeMsgForm.bankCardNo,

                   openAccountLicenceUrl: this.aptitudeMsgForm.openAccountLicenceUrl,
                    signName: this.aptitudeMsgForm.signName,
                   shortName: this.aptitudeMsgForm.shortName,

                   licenceNo: this.aptitudeMsgForm.licenceNo,
                   openAccountLicenceNo:this.aptitudeMsgForm.openAccountLicenceNo,
                   contactName: this.aptitudeMsgForm.contactName,
                   contactLicenceNo:this.aptitudeMsgForm.contactLicenceNo,
                   contactMobile:this.aptitudeMsgForm.contactMobile,
                   contactEmail:this.aptitudeMsgForm.contactEmail,
                   attachmentIds:this.aptitudeMsgForm.attachmentIds.join(',')
                 }
                }
                console.log(data);
                let result = await BstoreApply(data);
                if (result.code == 200) {
                    this.$message.success(result.msg);
                    setTimeout(()=>{this.$router.go(-1);},2000);
                }else{
                    this.$message.error(result.msg)
                }
                this.btnLoading = false;
        } catch (err) {
        	console.log(err)
        	this.btnLoading = false;
        }
      },
			areaChange() {
				this.storeMsgForm.storeAreaName = (this.$refs['cascaderAddr'].getCheckedNodes()[0].pathLabels).join(',');
			},
			getSelect() {
				BgetBankInfo({
					pageNum: 1,
					pageSize: 10000,
					searchKey: ''
				}).then(res => {
					this.bankList = res.rows
				}); /*开户行列表*/

        BgetBankAreaList().then(res => {
          let data =res.data;
          data.map(item=>{
            item.children.map(item1=>{
              item1.children.map(item2=>{
                item2.children = '';
              })
            })
          })
         this.bankAreaList = data;
				}); /*执照所在区域列表*/

				if (this.$route.query.type == 'add') {
					/*新增时候个人信息回填*/
					selReturnedValue({
						customerId: this.$route.query.customerId
					}).then(res => {
						if (res.code == '200') {
							this.isRealName = res.data.realname == '1' ? true : false;
              if (res.data.realname == '1') {
              	this.aptitudeMsgForm.legalName = res.data.name;
              	this.aptitudeMsgForm.legalLicenceNo = res.data.idcardNumber;
              	this.aptitudeMsgForm.legalLicenceFrontUrl = res.data.idcardFrontPic;
              	this.aptitudeMsgForm.legalLicenceBackUrl = res.data.idcardBackPic;
              }
              this.aptitudeMsgForm.legalMobile= res.data.telephone ? res.data.telephone : '';
              this.aptitudeMsgForm.bankCardNo = res.data.bankNumber ? res.data.bankNumber : '';

						}
					})
				}
        /*门店信息*/
        this.getSelectList('store_category_key').then(res=>{
          this.storeTypeList = res.data;
        })
			},
			back() {
				this.$router.go(-1);
			},
			normalizer(node) {
				if (node.children && !node.children.length) {
					delete node.children;
				}
				return {
					id: node.dictValue,
					label: node.dictLabel,
					children: node.children,
					//isDisabled: (node.children) ? true : false
				};
			},
			/** 营业执照地址 **/
			addressChange(arr,type){
        if(type=='storeAreaCode'){
          let arrs = [CodeToText[arr[0]], CodeToText[arr[1]], CodeToText[arr[2]]];
          vm.storeMsgForm.storeAreaName = arrs;
        }else{
          let arrs = [CodeToText[arr[0]], CodeToText[arr[1]], CodeToText[arr[2]]];
          vm.aptitudeMsgForm.blRegionName = arrs;
        }

			},
			/** 图片信息组件回传方法 **/
			imageChange(path, name, type) {
        console.log(path, name, type)
				if (type == 'aptitudeMsgForm') {
					this.aptitudeMsgForm[name] = path
				} else {
					this.storeMsgForm[name] = path
				}
			},
		}
	}
</script>
<style scoped lang="scss">
	.mapBox /deep/ iframe {
		height: 600px;
	}
  .certificationForm .right{
    width:50% !important;
    padding-right:20px;
  }
  .certificationForm /deep/ .el-card__body{
    flex-wrap: wrap;
  }
  .index-box /deep/ .el-form--label-top .el-form-item__label{
    padding:0px!important;
  }
  .miniTips{
    font-size: 12px;
    color:#CCC4CC;
    padding-left:4px;
  }
  .promoter /deep/ .el-form-item{
    width:50%;
    padding:0 20px;
  }
  .promoter /deep/ .el-card__body{
    flex-wrap: wrap;
  }
  .tabsBox{
    width: 75%;
    margin: 0 auto;
  }
	.storeAddressDetail /deep/ .el-input-group__append {
		background: #61997A;
		color: #fff;
	}

	.index-box {
		height: 100%;
		overflow-y: auto;
	}

	.right-box /deep/ .el-card__body {
		padding-bottom: 0px;
	}

	.right-box {
		margin-bottom: 10px;
	}

	.bottom-box {
		margin: 0 -5px 0 -5px;
	}

	.bottom-box /deep/ .el-card {
		width: 25%;
		margin: 0 5px;
	}

	.cardBox {
		margin-bottom: 15px;
	}

	.cardBox /deep/ .el-card__body {
		display: flex;
		padding: 0px;

		.left {
			flex: 1;
			padding: 20px;
		}

		.right {
			width:200px;
		}
	}
</style>
